<?php

namespace app\common\model;

use think\Model;


class SceneCheck extends Model
{

    

    

    // 表名
    protected $name = 'scene_check';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'fjq_status_text',
        'dbq_status_text',
        'cpq_status_text',
        'bgq_status_text'
    ];
    

    
    public function getFjqStatusList()
    {
        return ['1' => __('Fjq_status 1'), '2' => __('Fjq_status 2')];
    }

    public function getDbqStatusList()
    {
        return ['1' => __('Dbq_status 1'), '2' => __('Dbq_status 2')];
    }

    public function getCpqStatusList()
    {
        return ['1' => __('Cpq_status 1'), '2' => __('Cpq_status 2')];
    }

    public function getBgqStatusList()
    {
        return ['1' => __('Bgq_status 1'), '2' => __('Bgq_status 2')];
    }


    public function getFjqStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['fjq_status']) ? $data['fjq_status'] : '');
        $list = $this->getFjqStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getDbqStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['dbq_status']) ? $data['dbq_status'] : '');
        $list = $this->getDbqStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getCpqStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['cpq_status']) ? $data['cpq_status'] : '');
        $list = $this->getCpqStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getBgqStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['bgq_status']) ? $data['bgq_status'] : '');
        $list = $this->getBgqStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function admin()
    {
        return $this->belongsTo('Admin', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function stand()
    {
        return $this->belongsTo('Stand', 'stand_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
